In an Operating System, multiple processes run simultaneously and compete for limited system resources such as CPU, memory, files, and I/O devices. Sometimes, a situation arises where a group of processes are unable to proceed because each process is waiting for a resource that is held by another process in the same group. This situation is known as Deadlock.
Deadlock is one of the most important and frequently asked topics in Operating System (OS) for university exams, interviews, and competitive examinations. Understanding deadlock helps students design efficient systems and avoid serious performance problems.
In this article, we will study Deadlock in Operating System in detail, including its definition, necessary conditions, real-life examples, methods for handling deadlock, and important exam points.
This article is specially written for Computer Science students preparing for university exams, GATE, and technical interviews.
A deadlock is a condition in which a set of processes are permanently blocked because each process holds a resource and waits for another resource that is held by some other process.
In simple words: no process can continue execution, and the system comes to a standstill.
As a result, both processes wait forever.
Neither person is willing to release the resource they already have. As a result, both keep waiting forever. This is exactly how deadlock happens in an operating system.
| Process | Holds | Requests |
|---|---|---|
| P1 | R1 | R2 |
| P2 | R2 | R1 |
Both processes are waiting for each other’s resources. Hence, a deadlock occurs.
At least one resource must be held in a non-shareable mode.
Example: Printer, scanner, file write access.
A process must be holding at least one resource and waiting to acquire additional resources that are currently held by other processes.
Resources cannot be forcibly taken away from a process. A process releases resources only after completing its task.
If all four conditions are true, deadlock will definitely occur.
If the resource allocation graph contains a cycle, deadlock may or may not occur.
Ensure at least one deadlock condition never occurs.
Uses Banker’s Algorithm to check safe state before allocation.
Allows deadlock and then detects it using wait-for graphs.
Assumes deadlock never occurs (Ostrich Algorithm).
| Deadlock | Starvation |
|---|---|
| Processes wait forever | Process waits for a long time |
| Circular waiting | No circular wait |
| Permanent block | Temporary delay |
Deadlock is a critical concept in Operating Systems that occurs due to improper resource allocation among competing processes. By understanding deadlock conditions and handling techniques, system designers can build efficient and reliable systems.
Every Computer Science student must clearly understand deadlock, as it is a core topic for exams, interviews, and practical system design.
If you found this article helpful, share it with your classmates and explore other Operating System topics on CSE Gyan.
© 2026 CSE Gyan. All Rights Reserved.